import { Body, Controller, Delete, Get, Post, Put, Query } from '@nestjs/common';
import { DisciplineService } from './discipline.service';

@Controller('discipline')
export class DisciplineController {
    constructor(
        private readonly disciplineService: DisciplineService
    ) { }

    @Get()
    index(@Query() query: any) {
        return this.disciplineService.findAll(query);
    }

    @Post('add')
    add(@Body() body: any) {
        return this.disciplineService.add(body);
    }

    @Delete('delete')
    delete(@Body() body: any) {
        return this.disciplineService.delete(body.id);
    }

    @Put('update')
    update(@Body() body: any) {
        return this.disciplineService.update(body.id, body);
    }
    @Get('getDisciplinesByCollege')
    getDisciplinesByCollege(@Query() query: any) {
        return this.disciplineService.getDisciplinesByCollege({ id: query.id, college_name: query.college_name });
    }
}
